package com.icss.mqsp.quartz.service.impl;

import com.icss.mqsp.quartz.service.TaskService;
import com.icss.mqsp.quartz.trigger.CacheTriggerRunner;
import com.icss.pangu.logging.Log;
import com.icss.pangu.logging.LogFactory;
import org.quartz.SchedulerException;

public class TaskServiceImpl
  implements TaskService
{
  private static Log log = LogFactory.getLog(TaskServiceImpl.class);
  private static CacheTriggerRunner cacheTrigger = new CacheTriggerRunner();
  
  public void task()
  {
    log.info("...");
    cacheTask();
    log.info("缓存生成任务调度");
  }
  
  public void shutdown()
  {
    cacheTrigger.shutdown();
    log.debug("cache shutdown...");
  }
  
  public static void cacheTask()
  {
    try
    {
      cacheTrigger.task();
    }
    catch (SchedulerException e)
    {
      log.error("决策支持中心缓存生成任务调度错误信息===========");
      log.error(e.toString());
    }
  }
}
